// 搜搜结果列表接口

import request from "../../utils/request"
import { AnyObjType } from "../../views/charts/api/chartsApi";
import { reqSearchResultParamsType, searchDetailDataType } from "./type"


export const _reqSearchResult=(params:reqSearchResultParamsType)=>{
  return request.get<any,searchDetailDataType>(`/m-revision/page/search?kw=${params.kw}&core=${params.core}&page=${params.page}&rows=${params.rows}&paidFilter=${params.paidFilter}&fq=is_paid:${params.is_paid}&condition=${params.condition}&category_id=${params.category_id||''}`);
}

/* 拿全部页数据 */
export const _getSearchResult = (kw:string)=>{
  return request.get<any,any>(`/m-revision/page/search?kw=${kw}&core=all&page=1&rows=5`)
}

/* 拿专辑页分类数据 */
export const _getAlbumCategoryList = ()=>{
  return request.get<any,AnyObjType>(`/m-revision/page/category/queryCategoriesV2`)
}
// &paidFilter=${params.paidFilter}&fq=is_paid:${params.is_paid}
export const reqSearchResult=(params:any)=>{
  const url='/m-revision/page/search';
  if(params.fq.is_paid !==undefined){
    return request.get<any,searchDetailDataType>(`/m-revision/page/search?kw=${params.kw}&core=track&page=${params.page}&rows=20&condition=${params.condition}&paidFilter=${params.paidFilter}&fq=is_paid:${params.fq.is_paid}`);
  }else{
    return request.get<any,searchDetailDataType>(url,{
      params
    });
  }
 
};


export const reqAnchorResult=(params:reqSearchResultParamsType)=>{
  return request.get<any,searchDetailDataType>(`/m-revision/page/search?kw=${params.kw}&core=${params.core}&page=${params.page}&rows=${params.rows}&condition=${params.condition}`);
};
